﻿using System;
using System.IO;
using System.Text;
using System.Linq;
using System.Security.Cryptography.X509Certificates;

namespace OpenVpnAuth
{
    class Program
    {
        static string UserList = "userlist.txt";
        static int Main(string[] args)
        {
            if (args.Length > 0)
            {
                var fpath = args[0];
                if (fpath.EndsWith(".tmp"))
                {// the file contains username \n password
                    var lines=File.ReadAllLines(fpath);
                    var username = lines[0];
                    var password = lines[1];
                    var alllines=File.ReadAllLines(UserList);
                    if(alllines.Any(x=>x==username+":"+password))
                    {
                        return 0;
                    }
                }
            }
            return 1;
        }
    }
}
